
package com.etooling.framework.jpa.specification;

import javax.persistence.criteria.*;

public class IsNullSpecification<T> extends AbstractSpecification<T> {
    private final String property;

    public IsNullSpecification(String property ) {
        this.property = property;
    }

    @Override
    public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
        From from = getRoot(property, root);
        String field = getProperty(property);
        return cb.isNull(from.get(field));
    }
}
